package com.anlogic.sdk.tools.ui;

import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionClearAll;
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionCopy;
import org.eclipse.tm.internal.terminal.control.actions.TerminalActionPaste;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
import org.eclipse.tm.terminal.view.ui.actions.TabScrollLockAction;
import org.eclipse.tm.terminal.view.ui.interfaces.ITerminalsView;

public class TabFolderToolbarHandler extends org.eclipse.tm.terminal.view.ui.tabs.TabFolderToolbarHandler {
	public TabFolderToolbarHandler(ITerminalsView parentView) {
		super(parentView);
	}

	/**
	 * Create the toolbar actions.
	 */
	protected void doCreateToolbarActions() {
		// Create and add the paste action
		add(new TerminalActionPaste() {
			@Override
			protected ITerminalViewControl getTarget() {
				return getActiveTerminalViewControl();
			}
		});

		// Create and add the copy action
		add(new TerminalActionCopy() {
			@Override
			protected ITerminalViewControl getTarget() {
				return getActiveTerminalViewControl();
			}
		});

		// Create and add the scroll lock action
		add(new TabScrollLockAction() {
			@Override
			protected ITerminalViewControl getTarget() {
				return getActiveTerminalViewControl();
			}
		});

		// Create and add the clear all action
		add(new TerminalActionClearAll() {
			@Override
			protected ITerminalViewControl getTarget() {
				return getActiveTerminalViewControl();
			}

			@Override
			public void updateAction(boolean aboutToShow) {
				super.updateAction(aboutToShow);
				if (getTarget() != null && getTarget().getState() != TerminalState.CONNECTED) {
					setEnabled(false);
				}
			}
		});

		/* don't add this action
		// Create and add the toggle command input field action
		add(new ToggleCommandFieldAction(getParentView()) {
			@Override
			protected ITerminalViewControl getTarget() {
				return getActiveTerminalViewControl();
			}
		});

		// Create and add the new terminal view action
		add(new NewTerminalViewAction(getParentView()) {
			@Override
			protected ITerminalViewControl getTarget() {
				return getActiveTerminalViewControl();
			}
		});
		*/
	}
}
